<?php $this->load->module('mobile/index/header', $common);

if(!$GLOBALS['config']['mobileorderdisable']){
    $order_icon = '<img class="yd" src="img/rmxlbtn.png" data-original="img/rmxlbtn.png">';
}else{
    $order_icon = '';
}
?>

<div class="wrap" >
    <div class="container cl">
        <div class="jdbar cl " style="position:relative">
            <?php
            $TEMPLATE = <<<HTML
{listinfo}
<a href="{link}" target="_blank"><img alt="{title}" src="{pic}" /></a>
{/listinfo}
HTML;
            diy('line_topimglist_'.intval($cat_id).$cat, 'imagelist', $TEMPLATE);?>
        </div>
    </div>

    <div class="blank5"></div>
    <div class="jdsearch">
        <form action="<?php echo site_url('mobile/line/index')?>" method="get" >
            <input type="text" name="keyword" placeholder="输入景点/目的地..." >
        </form>
    </div>

    <div class="container cl">
        <div class="location cl">
<?php
$TEMPLATE_S = <<<HTML
<ul>
{links}
<li><small><a href="{link}" >{name}</a></small></li>
{/links}
</ul>
HTML;
diy('line_fontlist_'.intval($cat_id).$cat, 'fontlist',$TEMPLATE_S);
?>
        </div>
    </div>

    <div class="container"  id="js-line-list">
        <div class="rmxlbar">
            <img src="img/rmxl.png" data-original="img/rmxl.png">
        </div>
<?php if($datalist){foreach ($datalist as $v) { ?>
        <div class="rmxllsit">
            <ul>
                <li>
                    <a href="<?php echo $v['link'];?>" class="cl">
                    <div class="rmxllsit-1">
                        <div class="rmxllsit-img">

                            <img class="lazy" src="<?php echo URLPRE;?>static/public/images/nophoto.jpg" onerror="this.error=null;this.src='<?php echo URLPRE;?>static/public/images/nophoto.jpg'" data-original="<?php echo $v['file_url'];?>" alt="<?php echo $v['line_name'];?>">
                        </div>
                        <div class="rmxllsit-txt">
                            <ul>
                                <li><p>[<?php echo $v['line_name'];?>]</p></li>
                                <li><small><?php echo $v['short_name'];?></small></li>
                                <li>
                                     <span class="sort"><?php echo $v['sort_name']?></span>
                                     <span><?php echo $v['low_price'];?></span>
                                </li>
                                <li><?php echo $v['original'];?></li>
                                <li><span>已有<i><?php echo $v['visits'];?></i>人浏览</span>
                                        <?php if($order_icon){?>
                                            <?php if($v['low_price']=='电询'):?>
                                                <span class="paybtn">电询</span>
                                            <?php else:?>
                                                <span class="paybtn">立即预定</span>
                                            <?php endif;?>
                                        <?php }?>
                                 </li>
                            </ul>
                        </div>
                    </div>
                    </a>
                    <div class="line"></div>
                </li>
            </ul>
        </div>
<?php }}else{?>

    <div class="rmxllsit">
        <ul>
            <li>
                <div class="rmxllsit-1">
                    <a class="null" style="width:100%;text-align: center;display: block" href="tel:<?php echo $site_service_phone;?>">暂无线路，点击电询</a>
                </div>
                <div class="line"></div>
            </li>
        </ul>
    </div>

<?php }?>
    </div>

    <?php if($datalist){ ?><a href="javascript:;" class="btn-grey btn" id="js-load-more">加载更多</a>
    <?php }?>
</div>
<?php $this->load->module('mobile/index/footer', $common);?>
<script type="text/javascript">
var BASEURL = '<?php echo URLPRE;?>';
$(function(){
    var slid = $("#sliderimg").slider({
        loop: true
    });
    var scroll = 1;
    var page = <?php echo $page+1;?>;
    var keyword = '<?php echo $keyword?>';
    var cat_id = '<?php echo $cat_id ?>';
    var city_id = '<?php echo CURRENT_CITY_ID ?>';
    var url = '<?php echo site_url('mobile/line/index');?>';
    var cat = localStorage.getItem('cat<?php echo $cat_id ?>'), price = localStorage.getItem('price<?php echo $cat_id ?>');
    if(cat == null){
        cat = '<?PHP echo $_GET['cat']?>';
    }
    if(price == null){
        price = '<?PHP echo $_GET['price']?>';
    }
    var show_submit_button = 0;
    <?php if($order_icon){?>
    show_submit_button = 1;
    <?php }?>

    $(window).scroll(function(){

        totalheight = parseFloat($(window).height()) + parseFloat($(window).scrollTop());
        if ($(document).height() <= totalheight)
        {
            var $js_load_more = $('#js-load-more');
            $js_load_more.text('加载中...');
            $.get(url+(url.indexOf('?')!=-1 ?'&':'/?')+'isajax=1&city_id='+city_id+'&cat_id='+cat_id+'<?php echo "&city=$_GET[city]&dcity=$_GET[dcity]&day=$_G[day]&mark=$_GET[mark]"?>&keyword='+keyword+'&cat='+cat+'&price='+price+'&page='+page, function(data){
                if(data.length>0){

                    var html = '';
                    for(var i =0; i<data.length; i++){
                        var l = data[i];
                         var show_btn_string = (l.low_price=='电询')?'<span class="paybtn">电询</span>':'<span class="paybtn">立即预定</span>';
                        var btn_string = (show_submit_button==1)?show_btn_string:'';
                        html += '<div class="rmxllsit"><ul><li><a href="'+l.link+'" class="cl">'+
                                 '<div class="rmxllsit-1">'+
                                 '<div class="rmxllsit-img">'+
                                 '<img class="lazy" src="'+l.file_url+'" onerror="this.error=null;this.src='+l.file_url+'" alt="'+l.line_name+'" style="display:inline;">'+
                                 '</div><div class="rmxllsit-txt">'+
                                 '<ul><li><p>['+l.line_name+']</p></li>'+
                                 '<li><small>'+l.short_name+'</small></li>'+
                                 '<li><span class="sort">'+l.sort_name+'</span><span>'+l.low_price+'</span></li>'+
                                 '<li>'+l.original+'</li>'+
                                 '<li><span>已有<i>'+l.visits+'</i>人浏览</span>'+btn_string+'</li></ul>'+
                                 '</div></div></a><div class="line"></div></li></ul></div>';
                    }
                    $('#js-line-list').append(html);
                    page ++;
                    $js_load_more.text('加载更多');
                    return false;
                } else{


                    $js_load_more.text('没有更多了');
                    $.dialog({
                        style:'tip',
                        width:200,
                        closeTime:1000,
                        content: '<p style="text-align: center">没有更多了</p>'
                    }).open();
                    return false;
                }
            },'json');
        }




    })
});

</script>
<?php echo $sharehtml;?>